package com.fanco.learn_datastruct_leetcode.designpattern.interpreter;

import java.util.HashMap;

/**
 * ?????????
 * @author Administrator
 *
 */
public class AddExpression extends SymbolExpression  {

	public AddExpression(Expression left, Expression right) {
		super(left, right);
	}

	//???????
	//var ????? {a=10,b=20}..
	//???????debug ???,??ok
	@Override
	public int interpreter(HashMap<String, Integer> var) {
		//super.left.interpreter(var) ?? ???? left ?????????? a = 10
		//super.right.interpreter(var): ????right ???????? b = 20
		return super.left.interpreter(var) + super.right.interpreter(var);
	}
}
